Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Access to bar1/bar2/bar3 of a token without @{selected or @{target

Hello everyone! I was wondering if there is a way to access certain parts of a toekn / charactersheet without @{selected or @{target? I tried @{<character_name>|bar1} and I tried @{<token_id>|bar1} but I just get an error message telling me, that  No attribute was found for @{<token_name>|bar1} or  No character was found for '-LvZhNHniEyIvd0lSGZq' do I miss something or am I doing something horribly wrong? Thanks a lot for your help, Robert
1580972938
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Although you can reference a character sheet by name, I don't think this is possible with a token, or by token_id. At least, not without the API. Ex. Token-mod can do it.
Sorry if I've been a little unclear: I do not want to alter them, just to read them...or have someone who has no access to the token read a certain part of the token.
1580975770

Edited 1580975823
GiGs
Pro
Sheet Author
API Scripter
Thats an interesting question I hadnt considered before. I cant think of any way to do it without an API script. If your tokens represent a character, and the bar is linked, you can get the values by using their character name and the attribute name the bar is linked to. Doing it with a script has problems too - if you have a group of tokens representing the same character (like bandits, orcs, whatever), you'd have to ensure thetoken names are different. Not always the case. They would have unique IDs of course, but getting those without selected or target is tricky. A script could search for all tokens of a type, and present a list of their names or ids in chat, for you to use however you want. But this all sounds very clunky, when selected and target exist for this purpose. What task are you trying to achieve, that requires you to avoid using selected or target? Note: target lets a player select a token they cant normally select, so that's one way of creating a macro to read details.
Okay, to shine a little light on what I wanted to accomplish, I best describe my situation (sorry, English is not my native language): I do have a Calendar Token named Calendar that is linked to a character sheet. With the TokenMod script (thanks a lot for that The Aaron) I change bar1,bar2,bar3 and bar1_max, bar2_max and bar3_max to Time, Date, Day, Weather, Lunar Cycle and also the tint- and aura-colors of the Token. All that does work pretty well. Now I do want my players to access these informations without them having controll over the token. So I thought of a macro from the general macro bar that accesses the Calendar Token without the use of @{target and @{selected.
1581003437
The Aaron
Roll20 Production Team
API Scripter
I would make a character for the calendar, named Calendar. On the attributes and abilities tab, add 3 attributes named bar1, bar2, and bar3. Set the token to represent the Calendar character and link each of the bars to the same named attributes. In your macro use @{Calendar|bar1}, @{Calendar|bar1|max}, etc. You can still set them with TokenMod, and players can get them from the Character without having access to either.